﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Web.Models.Reservation>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Create Reservation
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Create Reservation</h2>

<% using (Html.BeginForm()) { %>
    <%: Html.AntiForgeryToken() %>
    <%: Html.ValidationSummary(true) %>

    <fieldset>
        <legend>Reservation</legend>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.Title) %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.Title) %>
            <%: Html.ValidationMessageFor(model => model.Title) %>
        </div>
        
        <div class="editor-label">
           <label>Room</label>
        </div>
        <div class="editor-field">
            <%: Html.DropDownListFor(model => model.RoomId, (IEnumerable<SelectListItem>)ViewBag.Rooms) %>
            <%: Html.ValidationMessageFor(model => model.RoomId) %>
        </div>

        <div class="editor-label">
            <label>Select Date</label>
        </div>
        <div class="editor-field">
            <input type="text" id="txtDate" name="txtDate" value="<%: DateTime.Today.ToShortDateString() %>" />
        </div>

        <div class="editor-label">
            <label>Start and end time</label>
        </div>
        <div class="editor-field">
            <input type="text" id="txtBegin" name="txtBegin" value="<%: string.Format("{0}:{1}", DateTime.Now.Hour + 1, "00") %>" style="width: 70px" /> - 
            <input type="text" id="txtEnd" name="txtEnd" style="width: 70px"/>
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
<% } %>

<div>
    <%: Html.ActionLink("Back to List", "Index") %>
</div>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">
    <%: Styles.Render("~/Content/css/jqueryui/datepicker") %>
    <%: Styles.Render("~/Content/css/timepicker") %>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsSection" runat="server">
    <%: Scripts.Render("~/bundles/jqueryval") %>
    <%: Scripts.Render("~/bundles/jqueryui") %>
    <%: Scripts.Render("~/bundles/timepicker") %>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#txtDate').datepicker({ minDate: "0d"});
            
            $('#txtBegin').timepicker({
                'step': 15,
                'scrollDefault': 'now',
                'forceRoundTime': true,
                'timeFormat': 'H:i'
            });
            
            $('#txtEnd').timepicker({
                'step': 15,
                'scrollDefault': 'now',
                'forceRoundTime': true,
                'timeFormat': 'H:i'
            });
        });
        
    </script>
</asp:Content>
